﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace Marmat.Forms.Local
{
    public static class RowExtension
    {
        /// <summary>
        /// 加载行。
        /// </summary>
        /// <param name="row"></param>
        public static void Load(this Marmat.Forms.Views.DataGrid.Row row)
        {
            if (row.DataGrid is Marmat.Forms.Local.DataGrid grid)
            {
                grid.LoadRow(row);
            }
        }

        /// <summary>
        /// 保存行。
        /// </summary>
        /// <param name="row"></param>
        public static void Save(this Marmat.Forms.Views.DataGrid.Row row)
        {
            if (row.DataGrid is Marmat.Forms.Local.DataGrid grid)
            {
                grid.Save(new System.Data.DataRow[] { row.BaseRow });
            }
        }
    }
}
